//
//  MBUtils.m
//  mZero-iOS
//
//  Created by Wang Yu on 4/25/16.
//  Copyright © 2016 Shenzhen Maker Works Technology Co., Ltd. All rights reserved.
//

#import "MBUtils.h"

@implementation MBUtils

+ (UIViewController *)getCurrentVC{
    UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
    UIViewController *topVC = appRootVC;
    while (topVC.presentedViewController) {
        topVC = topVC.presentedViewController;
    }
    return topVC;
}

+(NSString *)getPreferredLanguage{
    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
    NSArray * allLanguages = [defaults objectForKey:@"AppleLanguages"];
    NSString * preferredLang = [allLanguages objectAtIndex:0];
    return preferredLang;
}

@end